iOS Cloud Development For Dummies by Neal Goldstein

iOS Cloud Development For Dummies by Neal Goldstein

Author:Neal Goldstein
Language: eng
Format: epub
ISBN: 9781118235829
Publisher: Wiley
Published: 2012-07-26T00:00:00+00:00


void (^addFindLocationCompletionHandler)(Annotation *,

NSError *) = ^(Annotation *annotation, NSError *error){

if (error!= nil || annotation == nil) {

NSLog(@”Geocoder Failure! Error code: %u, description: %@, and reason: %@”, error.code,[error localizedDescription],

[error localizedFailureReason]);

}

else {

MKCoordinateRegion region;

region.center.latitude =

annotation.coordinate.latitude;

region.center.longitude =

annotation.coordinate.longitude;

region.span.latitudeDelta = .05;

region.span.longitudeDelta = .05;

[self.mapView setRegion:region animated:NO];

[self.mapView addAnnotation:annotation];

}

};

[[RTModel model] addLocation:self.findLocation

completionHandler:addFindLocationCompletionHandler];

}

}

The message includes a completion block, which I don’t need to explain here, but it’s in the RTModel addLocation:completionHandler: method where the actual geocoding occurs, as you can see bolded in Listing 7-5.

Listing 7-5: The Geocoding Request

- (void)addLocation: (NSString *)findLocation

completionHandler:(void (^)(Annotation *annotation,

NSError* error)) completion {



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.